<template>
  <div>
    <table-content :tableHeader="tableHeader" :tableData="tableData"></table-content>
  </div>
</template>

<script>
import TableContent from '@/components/table/table-content'

export default {
  components: {
    TableContent
  },
  data() {
    return {
      tableHeader: [
        { prop: 'id', label: '离职编号', minWidth: '100px', router: 'quitDetail', routerId: 'id', sortable: 'custom' },
        {
          prop: 'resignationUserName',
          label: '姓名',
          router: 'employeeDetail',
          routerId: 'resignationUserId',
          sortable: 'custom',
          headerAlign: 'center'
        },
        { prop: 'departName', label: '部门', minWidth: '100px', sortable: 'custom' },
        { prop: 'jobRole', label: '所在岗位', sortable: 'custom' },
        {
          prop: 'onbordingTime',
          label: '入职日期',
          formatData: function(val) {
            return this.formatDate(val, 'yyyy-MM-dd')
          },
          sortable: 'custom'
        },
        {
          prop: 'resignationTime',
          label: '离职日期',
          formatData: function(val) {
            return this.formatDate(val, 'yyyy-MM-dd')
          },
          minWidth: '100px',
          sortable: 'custom'
        },
        { prop: 'resignationReason', label: '离职原因', minWidth: '100px', sortable: 'custom' },
        { prop: 'status', label: '流程状态', minWidth: '100px', sortable: 'custom' }
      ],
      tableData: [
        {
          'id': 1,
          'resignationUserName': '张三',
          'departName': '事业部',
          'jobRole': '开发',
          'onbordingTime': 1593618372282,
          'resignationTime': 1593619372282,
          'resignationReason': '不想干了',
          'status': '等待'
        }
      ]
    }
  },
  methods: {
    selectionChangeHandle(obj) {
      console.log('get select ' + obj.backData)
    },
    sortChangeHandle(obj) {
      let column = obj.backData
      // 排序
      if (column.order) {
        // 倒序
        if (column.order === 'descending') {
          // this.query.sortColumn = column.prop + ' ' + 'desc';
        } else {
          // this.query.sortColumn = column.prop;
        }
      } else {
        // 不排序
        // this.query.sortColumn = '';
      }
      // 请求接口
    }
  }
}
</script>

<style>
</style>
